package com.chenfan.process.entity.po;

import java.util.Objects;

import com.baomidou.mybatisplus.annotation.TableName;
import com.chenfan.process.enums.BooleanEnum;

import lombok.Data;

/**
 * @author liuming
 * @date 2021/11/24
 */
@Data
@TableName(value = "process_form_node_relation")
public class ProcessFormNodeRelation {

    private Long id;

    /**
     * 表单的id
     */
    private Long formId;
    /**
     * 表单属性id
     */
    private Long formAttributeId;

    /**
     * 节点id
     */
    private Long processId;

    /**
     * 审批模板id
     */
    private Long approvalTemplateId;

    /**
     * 是否可编辑
     */
    private Integer editable;

    /**
     * 是否必填
     */
    private Integer required;

    /**
     * 版本
     */
    private Long version;

    public boolean editable() {
        return Objects.equals(BooleanEnum.Y.getCode(), editable);
    }

    public boolean required() {
        return Objects.equals(BooleanEnum.Y.getCode(), required);
    }

    @Data
    public static class Constants {
        public static final String APPROVAL_TEMPLATE_ID = "approval_template_id";
        public static final String PROCESS_ID = "process_id";
        public static final String REQUIRED = "required";
        public static final String EDITABLE = "editable";

        private Constants() {}
    }
}
